\hypertarget{classUDPSenderReceiver}{
\section{UDPSenderReceiver Class Reference}
\label{classUDPSenderReceiver}\index{UDPSenderReceiver@{UDPSenderReceiver}}
}
Inheritance diagram for UDPSenderReceiver::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classUDPSenderReceiver}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual size\_\-t \hyperlink{classUDPSenderReceiver_0bdb1089fff9950011278edd2e90f803}{send} (char $\ast$, size\_\-t)=0
\begin{CompactList}\small\item\em Sends data over UDP. \item\end{CompactList}\item 
virtual size\_\-t \hyperlink{classUDPSenderReceiver_2f8559cc694cce83608f8af6b3269d95}{send} (const size\_\-t \&)=0
\begin{CompactList}\small\item\em Sends a size\_\-t variable over UDP. \item\end{CompactList}\item 
\hypertarget{classUDPSenderReceiver_7aac76170c4bf735c59d2012d1ba336f}{
virtual size\_\-t \hyperlink{classUDPSenderReceiver_7aac76170c4bf735c59d2012d1ba336f}{send} (const std::string \&)=0}
\label{classUDPSenderReceiver_7aac76170c4bf735c59d2012d1ba336f}

\begin{CompactList}\small\item\em Sends a string over UDP. \item\end{CompactList}\item 
virtual size\_\-t \hyperlink{classUDPSenderReceiver_c4be359228c97971be27fad0392c49b0}{receive} (char $\ast$, size\_\-t)=0
\begin{CompactList}\small\item\em Accepts data over UDP. \item\end{CompactList}\item 
virtual size\_\-t \hyperlink{classUDPSenderReceiver_0bf1277afc02d7824af00b55bdadc448}{receive} (size\_\-t \&)=0
\begin{CompactList}\small\item\em Accepts a size\_\-t variable over UDP. \item\end{CompactList}\item 
size\_\-t \hyperlink{classUDPSenderReceiver_33778529b6859f6faec88ed9b1e5be98}{sendFile} (const char $\ast$source\_\-file)
\begin{CompactList}\small\item\em Sends a file over UDP. \item\end{CompactList}\item 
size\_\-t \hyperlink{classUDPSenderReceiver_17da272f0fddf0ad54763550bdc11dad}{receiveFile} (const char $\ast$target\_\-file)
\begin{CompactList}\small\item\em Receives a file over UDP. \item\end{CompactList}\item 
{\footnotesize template$<$typename Serializable$>$ }\\\hyperlink{classUDPSender}{UDPSender} \& \hyperlink{classUDPSenderReceiver_f3dc7d2d99ebc6c6300dee018c2b4cb6}{operator$<$$<$} (const Serializable \&obj)
\begin{CompactList}\small\item\em Send a Serializable object over UDP using boost serialization. \item\end{CompactList}\item 
{\footnotesize template$<$typename Serializable$>$ }\\\hyperlink{classUDPReceiver}{UDPReceiver} \& \hyperlink{classUDPSenderReceiver_888e5b61c422a22df4b615340bd9a126}{operator$>$$>$} (Serializable \&obj)
\begin{CompactList}\small\item\em Receive a Serializable object from UDP using boost serialization. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\hyperlink{classUDPSenderReceiver}{UDPSenderReceiver}

Abstract class that defines common methods and attributes for UDP Communication. Inheriting classes must implement \hyperlink{classUDPSenderReceiver_0bdb1089fff9950011278edd2e90f803}{send()} and \hyperlink{classUDPSenderReceiver_c4be359228c97971be27fad0392c49b0}{receive()} methods.

TODO: Check inheritance in order to avoid unnecessary redefinitions. 

\subsection{Member Function Documentation}
\hypertarget{classUDPSenderReceiver_0bdb1089fff9950011278edd2e90f803}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!send@{send}}
\index{send@{send}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[send]{\setlength{\rightskip}{0pt plus 5cm}virtual size\_\-t UDPSenderReceiver::send (char $\ast$, \/  size\_\-t)\hspace{0.3cm}{\tt  \mbox{[}pure virtual\mbox{]}}}}
\label{classUDPSenderReceiver_0bdb1089fff9950011278edd2e90f803}


Sends data over UDP. 

This class method uses provided buffer to acquire data, and should return the number of bytes written. 

Implements \hyperlink{classUDPSender_ae0bfafaadbbccb6a12b2860b0bfa95a}{UDPSender}.

Implemented in \hyperlink{classUDPClient_b0bb386fbae0a70b13f0f06fa1ada3b4}{UDPClient}, \hyperlink{classUDPServer_1_1Responder_b30e256fa0f086f4402f2ed1d87e08f4}{UDPServer::Responder}, and \hyperlink{classUDPServer_441a88c1187c9945bc281af76dd726ac}{UDPServer}.\hypertarget{classUDPSenderReceiver_2f8559cc694cce83608f8af6b3269d95}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!send@{send}}
\index{send@{send}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[send]{\setlength{\rightskip}{0pt plus 5cm}virtual size\_\-t UDPSenderReceiver::send (const size\_\-t \&)\hspace{0.3cm}{\tt  \mbox{[}pure virtual\mbox{]}}}}
\label{classUDPSenderReceiver_2f8559cc694cce83608f8af6b3269d95}


Sends a size\_\-t variable over UDP. 

Useful if you have an item larger than 1024 bytes, so you can warn the receiver that item size requires more than one packet. 

Implements \hyperlink{classUDPSender_176cd823dc08f7582dfd9fb97733c64a}{UDPSender}.

Implemented in \hyperlink{classUDPClient_9815d3657997a5799d5caf835a151ecb}{UDPClient}, \hyperlink{classUDPServer_1_1Responder_1f514bba6c1cfd9915d6d8f3dc819e4d}{UDPServer::Responder}, and \hyperlink{classUDPServer_501561f4120c5f50376c58558e4adeb4}{UDPServer}.\hypertarget{classUDPSenderReceiver_c4be359228c97971be27fad0392c49b0}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!receive@{receive}}
\index{receive@{receive}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[receive]{\setlength{\rightskip}{0pt plus 5cm}virtual size\_\-t UDPSenderReceiver::receive (char $\ast$, \/  size\_\-t)\hspace{0.3cm}{\tt  \mbox{[}pure virtual\mbox{]}}}}
\label{classUDPSenderReceiver_c4be359228c97971be27fad0392c49b0}


Accepts data over UDP. 

This class method uses provided buffer to save data, and should return the number of bytes read. 

Implements \hyperlink{classUDPReceiver_31b23df95675505ee2333e2674e2e13a}{UDPReceiver}.

Implemented in \hyperlink{classUDPClient_4719ca9fe37b62704d7ed8087eaf0d0c}{UDPClient}, and \hyperlink{classUDPServer_f419ea70dd008197494f4d023444e8fd}{UDPServer}.\hypertarget{classUDPSenderReceiver_0bf1277afc02d7824af00b55bdadc448}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!receive@{receive}}
\index{receive@{receive}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[receive]{\setlength{\rightskip}{0pt plus 5cm}virtual size\_\-t UDPSenderReceiver::receive (size\_\-t \&)\hspace{0.3cm}{\tt  \mbox{[}pure virtual\mbox{]}}}}
\label{classUDPSenderReceiver_0bf1277afc02d7824af00b55bdadc448}


Accepts a size\_\-t variable over UDP. 

Useful if you are waiting for an item larger than 1024 bytes, so you can be warned that more than one packet is incoming. 

Implements \hyperlink{classUDPReceiver_6b889964bfdbeee54eca03c28a970968}{UDPReceiver}.

Implemented in \hyperlink{classUDPClient_5f104c5f992b3e6186cd1bfd86f22f8a}{UDPClient}, and \hyperlink{classUDPServer_836343729c91b3ba5fe248b08ee3619c}{UDPServer}.\hypertarget{classUDPSenderReceiver_33778529b6859f6faec88ed9b1e5be98}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!sendFile@{sendFile}}
\index{sendFile@{sendFile}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[sendFile]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t UDPSenderReceiver::sendFile (const char $\ast$ {\em source\_\-file})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classUDPSenderReceiver_33778529b6859f6faec88ed9b1e5be98}


Sends a file over UDP. 

\begin{Desc}
\item[Author:]Marco Buzzanca Mind that it is necessary to call resolve() on Client (or bind() on Server) before using \hyperlink{classUDPSenderReceiver_17da272f0fddf0ad54763550bdc11dad}{receiveFile()}.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em source\_\-file}]path to local file from which data will be read. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]bytes written to socket, 0 if it fails. \end{Desc}
\hypertarget{classUDPSenderReceiver_17da272f0fddf0ad54763550bdc11dad}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!receiveFile@{receiveFile}}
\index{receiveFile@{receiveFile}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[receiveFile]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t UDPSenderReceiver::receiveFile (const char $\ast$ {\em target\_\-file})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classUDPSenderReceiver_17da272f0fddf0ad54763550bdc11dad}


Receives a file over UDP. 

Mind that it is necessary to call resolve() on Client (or bind() on Server) before using \hyperlink{classUDPSenderReceiver_17da272f0fddf0ad54763550bdc11dad}{receiveFile()}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em target\_\-file}]path to local file in which incoming data will be written. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]bytes read from socket, 0 if it fails. \end{Desc}
\hypertarget{classUDPSenderReceiver_f3dc7d2d99ebc6c6300dee018c2b4cb6}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!operator$<$$<$@{operator$<$$<$}}
\index{operator$<$$<$@{operator$<$$<$}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[operator$<$$<$]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Serializable$>$ {\bf UDPSender}\& UDPSenderReceiver::operator$<$$<$ (const Serializable \& {\em obj})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classUDPSenderReceiver_f3dc7d2d99ebc6c6300dee018c2b4cb6}


Send a Serializable object over UDP using boost serialization. 

Mind that it is necessary to call resolve() on Client (or bind() on Server) before using operator $>$$>$.

\begin{Desc}
\item[Note:]An object is serializable if it has a serialize() private method. See boost::serialize documentation.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em obj}]the object to serialize and send via UDP. \end{description}
\end{Desc}


Reimplemented from \hyperlink{classUDPSender_56a82a9d37f89a9bed72452c0be2935e}{UDPSender}.\hypertarget{classUDPSenderReceiver_888e5b61c422a22df4b615340bd9a126}{
\index{UDPSenderReceiver@{UDPSenderReceiver}!operator$>$$>$@{operator$>$$>$}}
\index{operator$>$$>$@{operator$>$$>$}!UDPSenderReceiver@{UDPSenderReceiver}}
\subsubsection[operator$>$$>$]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Serializable$>$ {\bf UDPReceiver}\& UDPSenderReceiver::operator$>$$>$ (Serializable \& {\em obj})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classUDPSenderReceiver_888e5b61c422a22df4b615340bd9a126}


Receive a Serializable object from UDP using boost serialization. 

Mind that it is necessary to call resolve() on Client (or bind() on Server) before using operator $>$$>$.

\begin{Desc}
\item[Note:]An object is serializable if it has a serialize() private method. See boost::serialize documentation.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em obj}]the Object which will receive unserialization data. \end{description}
\end{Desc}


Reimplemented from \hyperlink{classUDPReceiver_11327e719ed6cf835bf4fcbb82d9ca14}{UDPReceiver}.

Reimplemented in \hyperlink{classUDPServer_1_1Responder_6841d82ebbd1361ab9d95f3866af9694}{UDPServer::Responder}.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
\hyperlink{udpinterface_8cpp}{udpinterface.cpp}\end{CompactItemize}
